﻿@model VedranKrizicPortfolio.Models.Article

@{
    ViewBag.Title = "Edit";
}


<script type="text/javascript" src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/ckeditor/adapters/jquery.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div style="overflow: scroll; width: 641px; height: 538px;">
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend><b>Edit Article</b></legend>

        @Html.HiddenFor(model => model.id)

        <div class="edit-input">
            <div>
                @Html.LabelFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title)
            </div>
            <div>
                @Html.EditorFor(model => model.Title)
            </div>
        </div>

        <div class="edit-input">
            <div>
                Web Friendly Title
                @Html.ValidationMessageFor(model => model.wfTitle)
            </div>
            <div>
                @Html.EditorFor(model => model.wfTitle)
            </div>
        </div>

        <div class="edit-input">
            <div>
                @Html.LabelFor(model => model.Type)
            </div>
            <div>
                @Html.DropDownListFor(model => model.Type, new SelectList(ViewBag.ArticleTypes, "Type", "Name"))
            </div>
        </div>

        <div class="edit-input">
            <div>
                @Html.LabelFor(model => model.DateAdded)
            </div>
            <div>
                @Html.EditorFor(model => model.DateAdded)
                @Html.ValidationMessageFor(model => model.DateAdded)
            </div>
        </div>

        <div class="edit-input">
            <div>
                @Html.LabelFor(model => model.PublishDate)
            </div>
            <div>
                @Html.TextBoxFor(model => model.PublishDate, new { @type = "date", @class = "publishDate"})
                @Html.ValidationMessageFor(model => model.PublishDate)
            </div>        
        </div>

        <div class="edit-input">
            <div>
                @Html.LabelFor(model => model.CoverIMG)
            </div>
            <div>
                @Html.EditorFor(model => model.CoverIMG)
                @Html.ValidationMessageFor(model => model.CoverIMG)
            </div>        
        </div>

        <div style="clear:both; padding-top: 15px;"></div>

        <div>
            @Html.TextAreaFor(model => model.Text, new { @class = "adminRichText" })
        </div>
        <p>
            <input type="submit" value="Save" />
            @Html.ActionLink("Back to List", "ArticleList")
        </p>
    </fieldset>
}
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $(".adminRichText").ckeditor();
        $(".publishDate").datepicker({ dateFormat: 'yy-mm-dd' });
    });
</script>
